package classictravellersalesman;

import java.io.InputStream;
import java.util.Locale;
import java.util.Scanner;

public class RealGraph extends Graph {
	private Point coord[];
	public RealGraph(InputStream in) {
		Scanner sc = new Scanner(in);
		sc.useLocale(Locale.US);
		vertexCount = sc.nextInt();
		initMatrix(vertexCount);
		coord = new Point[vertexCount];
		for(int i=0;i<vertexCount;++i) {
			int num = sc.nextInt()-1;
			double x = sc.nextDouble();
			double y = sc.nextDouble();
			coord[num] = new Point();
			coord[num].x = x;
			coord[num].y = y;
			
		}
		
		for(int i=0;i<vertexCount;++i) {
			for(int j = i;j<vertexCount;++j) {
				double distance = Math.sqrt(Math.pow(coord[j].x-coord[i].x, 2) + Math.pow(coord[j].y-coord[i].y, 2));
				matrix[i][j] = distance;
				matrix[j][i] = distance;
			}
		}
		
	}
	public Point getPoint(int p) {
		return coord[p];
	}
	class Point {
		public double x;
		public double y;
		
		public Point() {
			x=0;
			y=0;
		}
	}
}
